- name: Install packages
  package: name={{item}} state=present
  with_items:
  - python-bugzilla
  - python-genshi
  tags:
  - review-stats
  - review-stats/build

- name: Ensure dir for content exists
  file: dest=/srv/web/review-stats owner=apache group=apache mode=0755 state=directory
  tags:
  - review-stats
  - review-stats/build

- name: Copy review-stats.py
  copy: >
    src=review-stats.py dest=/usr/local/bin/review-stats.py
    owner=root group=root mode=0755
  tags:
  - review-stats
  - review-stats/build

- name: Create /usr/local/share/review-stats
  file: path=/usr/local/share/review-stats state=directory owner=root group=root
  tags:
  - review-stats
  - review-stats/build

- name: Copy templates
  synchronize: src=templates dest=/usr/local/share/review-stats/
  tags:
  - review-stats
  - review-stats/build

- name: Copy config file
  template: >
    src=review-stats.cfg
    dest=/usr/local/share/review-stats/review-stats.cfg
    owner=root group=root mode=0644
  tags:
  - review-stats
  - review-stats/build

- name: Install the review-stats cronjob
  copy: >
    src=review-stats.cron dest=/etc/cron.d/review-stats.cron
    owner=root group=root mode=0644
  tags:
  - cron
  - review-stats
  - review-stats/build
